<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018\8\31 0031
 * Time: 13:06
 */

namespace app\validate;


use think\Validate;

class RoleValidate extends Validate
{
    protected $rule = [
        'parent_id'=>'require|number',
        'status'=>'require|number',
        'list_order'=>'number|between:0,9999',
        'name'=>'require|length:50',
        'remark'=>'require|length:255',
        'create_id'=>'require|number',
        'save_id'=>'require|number',
        'id'=>'require|number'
    ];
    protected $message = [
        'parent_id.number'=>'父级参数类型错误',
        'parent_id.require'=>'父级参数不能为空',
        'status.require'=>'状态参数不能为空',
        'status.number'=>'状态参数类型只能为数字',
        'list_order.number'=>'排序参数类型只能为数字',
        'list_order.between:0,9999'=>'排序参数只能在0~9999',
        'name.require'=>'角色名称不能为空',
        'name.length:50'=>'角色名称长度超出50',
        'remark.require'=>'角色备注不能为空',
        'remark.length:255'=>'角色备注长度不能超出255',
        'create_id.require'=>'添加人不能为空',
        'create_id.number'=>'添加人类型只能为数字',
        'save_id.require'=>'修改人不能为空',
        'save_id.number'=>'修改人类型只能为数字',
        'id.require'=>'未获取到roleId',
        'id.number'=>'roleId类型错误'

    ];
    protected $scene = [
        'add'=>['parent_id','status','list_order','name','remark','create_id'],
        'save'=>['parent_id','status','list_order','name','remark','save_id','id'],
    ];
}